// 引入 lodash 库，用于数据处理和操作

module.exports = (defaultR1Map, windowList, groupArray, flatGroupMap, numberGroupMap) => {
  groupArray.forEach((item) => {
    const key = item.group_name
    defaultR1Map[key].group_type = item.group_type
    defaultR1Map[key].accuracyList = windowList.map((item, index) => {
      if (index === 0) {
        return 1
      } else {
        // index 从 1 开始
        const prevNumber = windowList[index - 1].number
        const prevIndex = numberGroupMap[prevNumber][key]
        const prevGroup = flatGroupMap[key][prevIndex]
        return prevGroup
          .map((item) => item.toString().padStart(2, '0'))
          .includes(item.number.toString().padStart(2, '0'))
          ? 0
          : 1
      }
    })
  })

  return defaultR1Map
}
